#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>

using namespace std;

void test1()
{
	int n, t, find;
	while (cin >> n)
	{
		int* arr = new int[n];
		for (int i = 0; i < n; i++)
		{
			cin >> arr[i];
		}
		cin >> t;
		while (t--)
		{
			cin >> find;
			int i = 0;
			for (; i < n; i++)
			{
				if (find == arr[i])
				{
					cout << i + 1 << endl;
					break;
				}
			}
			if (i == n)
			{
				cout << "error" << endl;
			}
		}
	}
	
}

void test2()
{
	int n, t, find;
	while (scanf("%d", &n) != EOF)
	{
		int* arr = new int[n];
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &arr[i]);
		}
		scanf("%d", &t);
		while (t--)
		{
			scanf("%d", &find);
			int left = 0, right = n - 1, mid = 0, flag = 0;
			while (left <= right)
			{
				mid = (left + right) / 2;
				if (arr[mid] > find)
				{
					right = mid - 1;

				}
				else if (arr[mid] < find)
				{
					left = mid + 1;
				}
				else
				{
					flag = 1;
					cout << mid + 1 << endl;
					break;
				}
			}
			if (!flag)
			{
				cout << "error" << endl;
			}
		}
	}
}



int main()
{
	test2();
	return 0;
}
